import Vue from 'vue'
import 'es6-promise/auto'
import Vuex from 'vuex'
import App from './App'
import router from './router'
import Storage from '@/utils/StorageUtil'
import API from '@/utils/APIUtil'
import Toastr from '@/assets/toastr/toastr.min'
import element from 'element-ui'
import fetch from './utils/fetch'
import 'element-ui/lib/theme-chalk/index.css'


//定义提示框样式
Toastr.options = {
    closeButton: true,
    positionClass: 'toast-top-center',
    timeOut: 1500
}
//定义全局变量
Vue.prototype.Storage = Storage;
Vue.prototype.API = API;
Vue.prototype.Toastr = Toastr;

import vueQr from "vue-qr"
//导入Toastr CSS样式
import '@/assets/toastr/toastr.min.css'

Vue.config.productionTip = false
const extend = Vue.prototype
//使用Vuex状态管理器
Vue.use(Vuex)
Vue.use(element)

extend.$post = fetch.post
extend.$get = fetch.get
extend.$form = fetch.form

Vue.prototype.url = "/apis/"

const store = new Vuex.Store({
    user: null,
    amount: '',
    carshop: []
})



//注册组件
Vue.component("vueQr", vueQr);

new Vue({
    el: '#app',
    store,
    router,
    components: { App },
    template: '<App/>'
})
